<html>
<head><meta charset="utf-8"><title>trait object with life time bound · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/trait.20object.20with.20life.20time.20bound.html">trait object with life time bound</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207319444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/trait%20object%20with%20life%20time%20bound/near/207319444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jason Hu <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/trait.20object.20with.20life.20time.20bound.html#207319444">(Aug 18 2020 at 21:34)</a>:</h4>
<p>Hi all,</p>
<p>I am falling into a trouble understanding what is going wrong with this playground program: <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=26c33de788fbd6f048a4a3e1b1e04ca3">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=26c33de788fbd6f048a4a3e1b1e04ca3</a></p>
<p>Essentially, what I am trying to do is to pass around some trait objects with Cell so that I can implicitly mutate the states. But I don't quite see why Rust is complaining. could someone help me with that?</p>



<a name="207319584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/trait%20object%20with%20life%20time%20bound/near/207319584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/trait.20object.20with.20life.20time.20bound.html#207319584">(Aug 18 2020 at 21:36)</a>:</h4>
<div class="codehilite"><pre><span></span><code>fn get_getter&lt;&#39;a&gt;() -&gt; Rc&lt;dyn Getter&lt;&#39;a&gt; + &#39;a&gt; {
</code></pre></div>



<a name="207319655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/trait%20object%20with%20life%20time%20bound/near/207319655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/trait.20object.20with.20life.20time.20bound.html#207319655">(Aug 18 2020 at 21:37)</a>:</h4>
<p>I think without that extra lifetime, <code>Rc</code> is assumed <code>'static</code></p>



<a name="207320212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/trait%20object%20with%20life%20time%20bound/near/207320212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jason Hu <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/trait.20object.20with.20life.20time.20bound.html#207320212">(Aug 18 2020 at 21:44)</a>:</h4>
<p>thx. that saved my day!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>